package com.symaster.common.geom.entity;

import java.io.Serializable;

/**
 * @author yinmiao
 * @version 2022-03-29 09:15
 */
public class Size implements Serializable {

    private double w, h;

    public double area() {
        return w * h;
    }

    @Deprecated
    public Size() {
    }

    public Size(double w, double h) {
        this.w = w;
        this.h = h;
    }

    public double getW() {
        return w;
    }

    public void setW(double w) {
        this.w = w;
    }

    public double getH() {
        return h;
    }

    public void setH(double h) {
        this.h = h;
    }

    public org.opencv.core.Size toCvSize() {
        return new org.opencv.core.Size(w, h);
    }

    @Override
    public String toString() {
        return "Size{" +
                "w=" + Double.parseDouble(String.format("%.4f", w)) +
                ", h=" + Double.parseDouble(String.format("%.4f", h)) +
                '}';
    }
}
